package tuathal.snake;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JPanel;

public class SnakePane extends JPanel {
	private static final long serialVersionUID = 1L;
	protected Snake snake;

	public SnakePane(Snake snake) {
		super();
		this.snake = snake;
	}

	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		Node node = null;
		for (int i = 0; i < snake.body.size(); i++) {
			node = snake.body.get(i);
			g.setColor(Color.BLACK);
			g.fillRect(node.x, node.y, Node.W, Node.H);
		}
		node = snake.food;
		g.setColor(Color.RED);
		g.fillRect(node.x, node.y, Node.W, Node.H);
	}
}
